/**
 * 公共的js,使用别名简化路径配置
 * @author hanson 
 */

// 如果是ie浏览器  获取浏览器版本
function getIEVersion(){
	var userAgent = navigator.userAgent; // 取得浏览器的userAgent字符串
	var isOpera = userAgent.indexOf("Opera") > -1; // 判断是否Opera浏览器
	var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; // 判断是否IE浏览器
	if (isIE) {
		var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
		reIE.test(userAgent);
		var fIEVersion = parseFloat(RegExp["$1"]);console.log('fIEVersion:'+fIEVersion);
		if (fIEVersion == 7) {
			return 7;
		} else if (fIEVersion == 8) {
			return 8;
		} else if (fIEVersion == 9) {
			return 9;
		} else if (fIEVersion == 10) {
			return 10;
		} else if (fIEVersion == 11) {
			return 11;
		} else {
			return 0;
		}// IE版本过低
	}else{
		return -1;
	}
}

// adminLtePath
var _ap = _base + '/public/plugin/AdminLTE-2.4.3';
require.config({
	baseUrl: _base + '/resource',
	paths: {
	  'jquery': _ap + '/bower_components/jquery/dist/jquery.min',
      'bootstrap': _ap + '/bower_components/bootstrap/dist/js/bootstrap.min',
      'datatables.net': _ap + '/bower_components/datatables.net/js/jquery.dataTables.min',
      'datatables.net-bs': _ap + '/bower_components/datatables.net-bs/js/dataTables.bootstrap.min',
      'jquery.slimscroll': _ap + '/bower_components/jquery-slimscroll/jquery.slimscroll.min',
      'fastclick': _ap + '/bower_components/fastclick/lib/fastclick',
      'layer': 'public/plugin/layer-v3.0.3/layer/layer',
      'zeroclipboard': 'public/plugin/ueditor/third-party/zeroclipboard/ZeroClipboard.min',
	  'ueditor': 'public/plugin/ueditor/ueditor.all',
      'ueditor_zh-cn': 'public/plugin/ueditor/lang/zh-cn/zh-cn',
      'jquery.validate': 'public/plugin/jquery/jquery-validation-1.13.0/jquery.validate.min',
      'additional-methods': 'public/plugin/jquery/jquery-validation-1.13.0/additional-methods',
      'jquery-validate-messages_zh': 'public/plugin/jquery/jquery-validation-1.13.0/localization/messages_zh',
	  'jquery.zclip': 'public/plugin/jquery/zclip/jquery.zclip',

		// 自定义
      'adminlte': _ap + '/dist/js/adminlte.min',
      'adminlte.demo': _ap + '/dist/js/demo',
      'fileUtil': 'public/js/fileUtil',
      
      
      // 下面的这个项目还没用
      //'layer': 'public/plugin/layui/lay/modules/layer',
      'layui':'public/plugin/layui/layui-custom',
      'swiper': 'public/plugin/swiper/js/swiper.min',
      'jquery.nivo-slider': 'public/plugin/jquery/nivoslider/jquery.nivo.slider',
      'jquery.lazyload': 'public/plugin/jquery/lazyload/jquery.lazyload',
      'jquery.tools': 'public/plugin/jquery/tools/jquery.tools',
      'jquery.iselect': 'public/plugin/jquery/iselect/jquery.lSelect',
      'jquery.placeholder': 'public/plugin/jquery/placeholder/jquery.placeholder.min',
      'codemirror': 'admin/ueditor/third-party/codemirror/codemirror',
      'respond': 'public/plugin/Respond/respond',
      'slideBox':'public/plugin/slideBox/js/jquery.slideBox',
      'flexslider':'public/plugin/flexslider/jquery.flexslider-min',
      'WdatePicker':'public/plugin/WdatePicker/WdatePicker',
      'jquery.hDialog':'shop/default/js/dialog/jquery.hDialog',
      'jquery.liMarquee':'shop/default/js/dialog/jquery.liMarquee',
      'jquery.qrcode': 'public/plugin/jquery/qrcode/jquery.qrcode.min',
      'jquery.barcode': 'public/plugin/jquery/barcode/jquery.barcode.all.min',
      'jquery.poshytip': 'public/plugin/jquery/poshytip-1.2/src/jquery.poshytip',
      'jquery.print': 'public/plugin/jquery/print/jquery.print.min',
      'art-template': 'public/plugin/art-template/lib/template-web',
      
      'websocket': 'public/js/websocket/websocket',
	  'sockjs': 'public/js/websocket/sockjs'
    },
    map: { 
        '*': {
        	// 加载这个可以引入css样式    依赖中以  css! 开头 
            'css': 'public/plugin/requirejs/lib/css'
        }
    },
    shim:{
    	/*'jquery': {
    		init:function($){
    			return $.noConflict();
    		}
    	},*/
    	'bootstrap': {
    		deps:['jquery']
    	},
    	'datatables.net': {
    		deps:['jquery']
    	},
    	'datatables.net-bs': {
    		deps:['jquery', 'bootstrap', 'datatables.net']
    	},
    	'jquery.slimscroll': {
    		deps:['jquery']
    	},
    	'layer': {
			deps:['css!public/plugin/layer-v3.0.3/layer/skin/default/layer','jquery']
		},
    	'ueditor': {
			deps:['zeroclipboard','public/plugin/ueditor/ueditor.config','css!public/plugin/ueditor/themes/default/css/ueditor'],
			exports: 'UE',
            init:function(ZeroClipboard){
                //导出到全局变量，供ueditor使用
                window.ZeroClipboard = ZeroClipboard;
            }
		},
		'ueditor_zh-cn': {
			deps:['ueditor']
		},
		'jquery.validate': {
			deps:['jquery']
		},
		'additional-methods': {
			deps:['jquery.validate']
		},
		'jquery-validate-messages_zh': {
			deps:['additional-methods','jquery.validate']
		},
		'jquery.zclip': {
			deps:['jquery']
		},
    	
		
    	'adminlte': {
    		deps:['jquery']
    	},
    	'adminlte.demo': {
    		deps:['jquery', 'adminlte']
    	},
    	
    	
		
		'layui': {
			deps:['css!public/plugin/layui/css/layui']
		},
		'swiper': {
			deps:['css!public/plugin/swiper/css/swiper.min']
		},
		'jquery.nivo-slider': {
			deps:['css!public/plugin/jquery/nivoslider/nivo-slider','css!public/plugin/jquery/nivoslider/themes/default/default']
		},
		'codemirror': {
			deps:['css!admin/ueditor/third-party/codemirror/codemirror']
		},
		'WdatePicker': {
			deps:['css!public/plugin/WdatePicker/skin/default/datepicker']
		},
		'jquery.poshytip': {
			deps:['css!public/plugin/jquery/poshytip-1.2/src/tip-yellow/tip-yellow']
		},
		'art-template': {
			init:function(ArtTemplate){
				ArtTemplate.defaults.imports.$ = $; // 导入变量
				return ArtTemplate;
			}
		}
    }
});
var ie_version = getIEVersion();
if(ie_version >= 0 && ie_version <= 9){
	// 使ie9以下支持placeholder
	require(['respond','jquery.placeholder'],function(){
	    $('input, textarea').placeholder();
	});
}


